package com.soonfor.systemcodes;

import android.content.Context;

import com.soonfor.evaluate.tools.Tokens;

import org.apache.http.message.BasicNameValuePair;

/**
 * author : DC-DingYG
 * e-mail : dingyg012655@126.com
 * time : 2019/03/18
 * desc : *
 */
public class SystemCodes {

    static SystemCodes instance;

    private SystemCodes() {
    }

    public synchronized static SystemCodes getInstance() {
        if (instance == null) {
            instance = new SystemCodes();
        }
        return instance;
    }

    private String DSM_IfShowOtherPoint = "1"; //家装现场 是否使用其他任务和客户评价功能
    private String CRM_DlvIstManCanSelMore = "";//家装APP的送货派工及安装派工可多选派工人员
    private int DSM_IfFinishCanUpdateAttaOnly = 0;//是否可多人上传图片 默认不可
    private int DSM_IstFinishMustVideo = 0;//安装和送货必须上传视频
    private int DSM_FinishMustRemark = 0;//安装和送货必须上传备注

    public String getDSM_IfShowOtherPoint() {
        return DSM_IfShowOtherPoint==null ? "" : DSM_IfShowOtherPoint;
    }

    public void setDSM_IfShowOtherPoint(String DSM_IfShowOtherPoint) {
        this.DSM_IfShowOtherPoint = DSM_IfShowOtherPoint;
    }

    public String getCRM_DlvIstManCanSelMore() {
        return CRM_DlvIstManCanSelMore==null ? "" : CRM_DlvIstManCanSelMore;
    }

    public void setCRM_DlvIstManCanSelMore(String CRM_DlvIstManCanSelMore) {
        this.CRM_DlvIstManCanSelMore = CRM_DlvIstManCanSelMore;
    }

    public int getDSM_IfFinishCanUpdateAttaOnly() {
        return DSM_IfFinishCanUpdateAttaOnly;
    }

    public void setDSM_IfFinishCanUpdateAttaOnly(int DSM_IfFinishCanUpdateAttaOnly) {
        this.DSM_IfFinishCanUpdateAttaOnly = DSM_IfFinishCanUpdateAttaOnly;
    }

    public void setDSM_FinishMustRemark(int DSM_FinishMustRemark) {
        this.DSM_FinishMustRemark = DSM_FinishMustRemark;
    }

    public void setDSM_IstFinishMustVideo(int DSM_IstFinishMustVideo) {
        this.DSM_IstFinishMustVideo = DSM_IstFinishMustVideo;
    }

    public int getDSM_FinishMustRemark() {
        return DSM_FinishMustRemark;
    }

    public int getDSM_IstFinishMustVideo() {
        return DSM_IstFinishMustVideo;
    }

    public void initValues() {
        setDSM_IfShowOtherPoint("1");
        setCRM_DlvIstManCanSelMore("");
        setDSM_IfFinishCanUpdateAttaOnly(0);
    }

    public void setValues(Context context, SystemCodeBean codeBean) {
        if (codeBean != null) {
            if (codeBean.getFcodeid().equalsIgnoreCase(Tokens.DSM_IFSHOWOTHERPOINT)) {
                if (codeBean.getFword().equals("0")) {
                    SystemCodes.getInstance().setDSM_IfShowOtherPoint("0");
                }else {
                    SystemCodes.getInstance().setDSM_IfShowOtherPoint("1");
                }
            }else if (codeBean.getFcodeid().equalsIgnoreCase(Tokens.CRM_DLVISTMANCANSELMORE)) {
                if(codeBean.getFword().equals("1")) {
                    setCRM_DlvIstManCanSelMore("1");
                }else {
                    setCRM_DlvIstManCanSelMore("0");
                }
            }else if (codeBean.getFcodeid().equalsIgnoreCase(Tokens.DSM_IfFinishCanUpdateAttaOnly)) {
                if (codeBean.getFword().equals("1")) {
                    setDSM_IfFinishCanUpdateAttaOnly(1);
                }else {
                    setDSM_IfFinishCanUpdateAttaOnly(0);
                }
            }else if (codeBean.getFcodeid().equalsIgnoreCase(Tokens.DSM_FinishMustRemark)){
                if (codeBean.getFword().equals("1")){
                    setDSM_FinishMustRemark(1);
                }else {
                    setDSM_FinishMustRemark(0);
                }
            }else if (codeBean.getFcodeid().equalsIgnoreCase(Tokens.DSM_IstFinishMustVideo)) {
                if (codeBean.getFword().equals("1")){
                    setDSM_IstFinishMustVideo(1);
                }else {
                    setDSM_IstFinishMustVideo(0);
                }
            }
        }
    }
}
